import os, shutil

p = 'd:/BaiduNetdiskDownload'

os.chdir(p)
for a, b, c in os.walk(p):
    if a != p:
        for f in c:
            g = os.path.join(a, f)
            print g.decode('gbk')
            if os.path.exists(f):
                j = os.path.splitext(f)
                i = 1
                while 1:
                    f = j[0] + str(i) + '.' + j[-1]
                    if not os.path.exists(f):
                        print '->' + f.decode('gbk')
                        break
                    i += 1
            shutil.move(g, f)
